<template>
  <el-tag
    v-if="type != 'service'"
    :type="{0: 'danger', 12: 'warning', 13: 'warning', 14: 'warning', 15: 'success', 16: 'danger'}[status || 0]"
    v-bind="$attrs"
  >
    {{status ? DictMan.itemMap('productOrder.status')[status] : '订单不存在'}}
  </el-tag>
  <el-tag
    v-else
    :type="{0: 'danger', 12: 'warning', 13: 'warning', 14: 'warning', 15: 'success', 16: 'danger'}[status || 0]"
    v-bind="$attrs"
  >
    {{status ? serviceOrderStatusMap[status] : '订单不存在'}}
  </el-tag>
</template>

<script>
const serviceOrderStatusItems = [
  {value: '10,11', text: '服务未开始'},
  {value: '12,13,14', text: '服务进行中'},
  {value: '15', text: '服务已完成'},
  {value: '16', text: '服务已取消'}
];
export default {
  inheritAttrs: false,
  props: {
    status: {
      type: [String, Number]
    },
    type: {
      type: String,
      default: 'normal'
    }
  },
  computed: {
    serviceOrderStatusMap() {
      let statusMap = {};
      serviceOrderStatusItems.forEach(function(item) {
        item.value.split(',').forEach(function(k) {
          statusMap[k] = item.text;
        });
      });
      return statusMap;
    }
  },
  serviceOrderStatusItems,
  colors: {0: '#F56C6C', 10: '#409EFF', 12: '#E6A23C', 13: '#E6A23C', 14: '#E6A23C', 15: '#67C23A', 16: '#F56C6C'}
}
</script>